<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ForumThreads.ascx.cs" Inherits="forums_controls_forums_ForumThreads" %>
<%@ Register Src="../misc/Pager.ascx" TagName="Pager" TagPrefix="uc1" %>
<asp:GridView runat="server" ID="gridThreads" AutoGenerateColumns="false" Width="100%" GridLines="None">
    <Columns>
        <asp:TemplateField>
            <HeaderTemplate>Thread</HeaderTemplate>
            <ItemTemplate>
                <%# ThreadLocked((DAL.Thread.ThreadStatus)Eval("Status")) %>
                <%# ThreadPriority((DAL.Thread.ThreadPriority)Eval("Priority")) %>
                <asp:HyperLink runat="server" ID="lnkFirstPost"
                    NavigateUrl='<%# Helpers.StringHelper.SafeFormat("~/forums/thread.aspx?t={0}", Eval("ID")) %>'
                    Text='<%# Helpers.StringHelper.SafeFormat(Eval("FirstPost.Subject")) %>'
                    ToolTip='<%# GetFirst500Chars(Helpers.StringHelper.SafeFormat(Eval("FirstPost.Content") as string)) %>'
                />
                <uc1:Pager ID="Pager1" runat="server"
                    TotalPages='<%# Eval("TotalPages") %>'
                    HeaderText="(Page "
                    FooterText=")"
                    MaximumPages="10"
                    CurrentPage="0"
                    UrlFormat='<%# Helpers.StringHelper.SafeFormat("~/forums/thread.aspx?t={0}&page={{0}}", Eval("ID")) %>' />
                <br />
                <asp:HyperLink runat="server" ID="lnkThreadStarter"
                    Text='<%# Helpers.StringHelper.SafeFormat(Eval("FirstPost.User.Username")) %>'
                    NavigateUrl='<%# Helpers.StringHelper.SafeFormat("~/forums/profile.aspx?u={0}", Eval("FirstPost.User.ID")) %>' />
            </ItemTemplate>
            <HeaderStyle CssClass="forum_primary_header" />
        </asp:TemplateField>
        <asp:BoundField DataField="TotalReplies" HeaderText="Posts" >
            <HeaderStyle CssClass="forum_secondary_header" />
            <ItemStyle CssClass="forum_secondary_item" />
        </asp:BoundField>
        <asp:BoundField DataField="TotalViews" HeaderText="Views" >
            <HeaderStyle CssClass="forum_secondary_header" />
            <ItemStyle CssClass="forum_secondary_item" />
        </asp:BoundField>
        <asp:TemplateField>
            <HeaderTemplate>Last Post</HeaderTemplate>
            <ItemTemplate>
                <asp:HyperLink runat="server" ID="lnkUser"
                    Text='<%# Helpers.StringHelper.SafeFormat(Eval("LastPost.User.Username")) %>'
                    NavigateUrl='<%# Helpers.StringHelper.SafeFormat("~/forums/profile.aspx?u={0}", Eval("LastPost.User.ID")) %>'/>
                <sup>
                <asp:HyperLink runat="server" ID="lnkLastPost"
                    Text="-&gt;"
                    NavigateUrl='<%# Helpers.StringHelper.SafeFormat("~/forums/thread.aspx?p={0}#{0}", Eval("LastPost.ID")) %>'
                />
                </sup>
                <%# (Eval("LastPost") as DAL.Post).DatePosted.ToString("yyyy-MMM-dd hh:mm tt") %>
            </ItemTemplate>
            <HeaderStyle CssClass="forum_secondary_header" />
        </asp:TemplateField>
    </Columns>
    <EmptyDataTemplate>
        Be the first person to create start a new thread in this forum, you dirty troglodyte, you.
    </EmptyDataTemplate>
    <AlternatingRowStyle CssClass="forum_altgridrow" />
</asp:GridView>